package com.zg.ktcomwan.ext

import android.widget.Toast
import com.zg.ktcomwan.appContext
import com.zg.ktcomwan.data.BaseResp

/***
 * @Author:      zxd
 * @CreateDate:  2021/6/2 15:08
 * @Description:
 */

/*数据解析扩展函数*/
fun <T> BaseResp<T>.dataConvert(): T {
    //这里返回的不是200，是0
    if (errorCode == 0) {
        return data
    } else {
        throw Exception(errorMsg)
    }
}

fun toast(msg: String) {
    Toast.makeText(appContext, msg, Toast.LENGTH_SHORT)
}
